package com.blog.module.user.controller;

import java.util.Properties;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import com.blog.common.controller.BaseController;
import com.blog.common.mybatis.Page;
import com.blog.module.user.pojo.User;
import com.blog.module.user.service.UserService;

@Controller
@RequestMapping("user/*")
public class UserController extends BaseController {

	@Autowired
	public UserService userService;



	@RequestMapping("list")
	public String user(Model model) {
		Page page = userService.queryPageUser();
		model.addAttribute("page", page);
		return "admin/user/list";
	}

	@RequestMapping(value = "insert", method = RequestMethod.GET)
	public String insert() {
		return "user/front/add";
	}
	@RequestMapping(value = "insert", method = RequestMethod.POST)
	public String insert(User user) {
		userService.insert(user);
		return redirect("/user/list");
	}
}
